# -*- coding: utf-8 -*-
import requests
import json

url_login = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/login"
req_data = {"username": "125@qq.com",
            "password": "12345678",
            "userType": 0,
            "loginType": 0}
resp = requests.post(url_login, json=req_data)
req_dict_login = resp.json()
token = req_dict_login["data"]["token"]



url_query_house = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/house/query?pageSize=1000&pageNum=1&query=community_id:eq:164506857300001%3Btype:eq:%3Bidentifier:like:%3Bstate:eq:%3Bor%3Bhouse_name:like:%25%25%3Bhousehold_mobile:like:%25%25%3Bhousehold_name:like:%25%25"
req_heder = {"token": token}
resp_house = requests.get(url_query_house, headers=req_heder)
req_dict_house = resp_house.json()
# print(req_dict_house)
req_house_all_id = req_dict_house["data"]["list"]
# house_id = req_dict_house["data"]["list"][0]["id"]
# print(house_id)
# print(req_house_all_id)


houseid = []
for i in req_house_all_id:
    houseid.append(i.get("id"))
    print(houseid)
# for index in range(len(req_house_all_id)):
#     house_all_id = req_house_all_id[index]
#     # print(house_all_id)
#     for i in house_all_id:
#         houseid.append(i.get("id"))
#         print(houseid)



# url_edit_house = "https://yunyan-test.frp.xxbu.cn/api/sasc-aggregation-property-web/house/update/164507005800004"
# edit_data = {"id": 164507005800004,
#              "identifier": "100004-1-1-1-4-404",
#              "houseIdentifierShort": "1-1-4-404",
#              "communityName": "汇豪世纪",
#              "buildingId": 164506864200001,
#              "unitId": 164506864200001,
#              "houseNum": "404",
#              "floor": 4,
#              "salesArea": 94.83,
#              "usableArea": 94.84,
#              "type": "1",
#              "layout": "",
#              "layoutName": None,
#              "propertyType": "1",
#              "propertyTypeName": "自有房产",
#              "state": "1",
#              "stateName": "已入住",
#              "communityId": 164506857300001,
#              "houseName": "1栋-1单元-404",
#              "householdName":None,
#              "typeName":"住宅",
#              "householdMobile":None,
#              "householders":[{"id":164515024100001,"name":"周春红","sex":0,"nation":None,"type":1,"birthDate":"1978-06-17","birthPlace":None,"certificateType":1,"idNumber":"513522197806172013","mobile":"18180573632","checkInDate":1645150241,"outmigrationDate":None,"communityName":None,"houseIdentifier":"100004-1-1-1-4-404","houseIdentifierShort":"1-1-4-404","state":1,"stateName":None,"phone":None,"career":None,"employer":None,"address":None,"remark":None,"communityId":164506857300001,"gmtCreate":1645150241,"gmtModified":1665557113,"householdRegistrationAddress":None,"userId":164307607900001,"userName":None,"houseName":None,"houseCode":None}],"assetsHouseDTOS":[{"residentType":1,"residentTypeName":"户主本人","checkInDate":1665557163,"houseResidentId":164698236800001,"expiredDate":4102329599,"state":1,"name":"小明","sex":0,"mobile":"18180573632","birthDate":"1997-01-04","certificateType":2,"idNumber":"123456789","career":"程序猿程序猿程序猿程序猿程序猿程序猿程序","householdRegistrationAddress":"成都市武侯区簇桥街道铁佛寺庙会有的地方没有什么情况怎么样啦！","employer":"","remark":None},{"residentType":4,"residentTypeName":"子女","checkInDate":1665561637,"houseResidentId":166521191000001,"expiredDate":4102329599,"state":1,"name":"小刚","sex":0,"mobile":"19150218590","birthDate":"1990-01-10","certificateType":1,"idNumber":"","career":"","householdRegistrationAddress":"","employer":"","remark":None}]}
# req_heder = {"token": token}
# resp_edit_house = requests.post(url_edit_house, json=edit_data, headers=req_heder)
# req_edit_house = resp_edit_house.json()
# print(req_edit_house)


